home *** CD-ROM | disk | FTP | other *** search
/ Giga Games 1 / Giga Games.iso / net / usenet / volume11 / larn / part02 < prev    next >
Encoding:
Internet Message Format  |  1991-01-03  |  53.5 KB

  1. Path: uunet!zephyr.ens.tek.com!tekred!saab!billr
  2. From: billr@saab.CNA.TEK.COM (Bill Randle)
  3. Newsgroups: comp.sources.games
  4. Subject: v11i085:  larn - dungeon type adventure game, Part02/11
  5. Message-ID: <6716@tekred.CNA.TEK.COM>
  6. Date: 18 Dec 90 18:30:24 GMT
  7. Sender: news@tekred.CNA.TEK.COM
  8. Lines: 1296
  9. Approved: billr@saab.CNA.TEK.COM
  10.  
  11. Submitted-by: routley@tle.ENET.DEC.COM (Kevin Routley)
  12. Posting-number: Volume 11, Issue 85
  13. Archive-name: larn/Part02
  14. Environment: Unix, VMS, MS-DOS, termcap
  15.  
  16.  
  17.  
  18. #! /bin/sh
  19. # This is a shell archive.  Remove anything before this line, then unpack
  20. # it by saving it into a file and typing "sh file".  To overwrite existing
  21. # files, type "sh file -c".  You can also feed this as standard input via
  22. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  23. # will see the following message at the end:
  24. #        "End of archive 2 (of 11)."
  25. # Contents:  data.c display.c larn.opt larn.prj
  26. # Wrapped by billr@saab on Tue Dec 18 10:14:15 1990
  27. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  28. if test -f 'data.c' -a "${1}" != "-c" ; then 
  29.   echo shar: Will not clobber existing file \"'data.c'\"
  30. else
  31. echo shar: Extracting \"'data.c'\" \(31189 characters\)
  32. sed "s/^X//" >'data.c' <<'END_OF_FILE'
  33. X/*  data.c      Larn is copyrighted 1986 by Noah Morgan. */
  34. X#define NODEFS
  35. X#include "header.h"
  36. X
  37. X/*
  38. X    class[c[LEVEL]-1] gives the correct name of the players experience level
  39. X */
  40. Xstatic char aa1[] = " mighty evil master";
  41. Xstatic char aa2[] = "apprentice demi-god";
  42. Xstatic char aa3[] = "  minor demi-god   ";
  43. Xstatic char aa4[] = "  major demi-god   ";
  44. Xstatic char aa5[] = "    minor deity    ";
  45. Xstatic char aa6[] = "    major deity    "; 
  46. Xstatic char aa7[] = "  novice guardian  ";
  47. Xstatic char aa8[] = "apprentice guardian";
  48. Xstatic char aa9[] = "    The Creator    ";
  49. Xchar *class[]=
  50. X{   "  novice explorer  ", "apprentice explorer", " practiced explorer",/*  -3*/
  51. X    "   expert explorer ", "  novice adventurer", "     adventurer    ",/*  -6*/
  52. X    "apprentice conjurer", "     conjurer      ", "  master conjurer  ",/*  -9*/
  53. X    "  apprentice mage  ", "        mage       ", "  experienced mage ",/* -12*/
  54. X    "     master mage   ", " apprentice warlord", "   novice warlord  ",/* -15*/
  55. X    "   expert warlord  ", "   master warlord  ", " apprentice gorgon ",/* -18*/
  56. X    "       gorgon      ", "  practiced gorgon ", "   master gorgon   ",/* -21*/
  57. X    "    demi-gorgon    ", "    evil master    ", " great evil master ",/* -24*/
  58. X      aa1       ,   aa1       ,   aa1       ,/* -27*/
  59. X      aa1       ,   aa1       ,   aa1       ,/* -30*/
  60. X      aa1       ,   aa1       ,   aa1       ,/* -33*/
  61. X      aa1       ,   aa1       ,   aa1       ,/* -36*/
  62. X      aa1       ,   aa1       ,   aa1       ,/* -39*/
  63. X      aa2       ,   aa2       ,   aa2       ,/* -42*/
  64. X      aa2       ,   aa2       ,   aa2       ,/* -45*/
  65. X      aa2       ,   aa2       ,   aa2       ,/* -48*/
  66. X      aa3       ,   aa3       ,   aa3       ,/* -51*/
  67. X      aa3       ,   aa3       ,   aa3       ,/* -54*/
  68. X      aa3       ,   aa3       ,   aa3       ,/* -57*/
  69. X      aa4       ,   aa4       ,   aa4       ,/* -60*/
  70. X      aa4       ,   aa4       ,   aa4       ,/* -63*/
  71. X      aa4       ,   aa4       ,   aa4       ,/* -66*/
  72. X      aa5       ,   aa5       ,   aa5       ,/* -69*/
  73. X      aa5       ,   aa5       ,   aa5       ,/* -72*/
  74. X      aa5       ,   aa5       ,   aa5       ,/* -75*/
  75. X      aa6       ,   aa6       ,   aa6       ,/* -78*/
  76. X      aa6       ,   aa6       ,   aa6       ,/* -81*/
  77. X      aa6       ,   aa6       ,   aa6       ,/* -84*/
  78. X      aa7       ,   aa7       ,   aa7       ,/* -87*/
  79. X      aa8       ,   aa8       ,   aa8       ,/* -90*/
  80. X      aa8       ,   aa8       ,   aa8       ,/* -93*/
  81. X    "  earth guardian   ", "   air guardian    ", "   fire guardian   ",/* -96*/
  82. X    "  water guardian   ", "  time guardian    ", " ethereal guardian ",/* -99*/
  83. X      aa9       ,   aa9       ,   aa9       ,/* -102*/
  84. X};
  85. X
  86. X/*
  87. X    table of experience needed to be a certain level of player
  88. X    skill[c[LEVEL]] is the experience required to attain the next level
  89. X */
  90. X#define MEG 1000000
  91. Xlong skill[] = {
  92. X0, 10, 20, 40, 80, 160, 320, 640, 1280, 2560, 5120,                  /*  1-11 */
  93. X10240, 20480, 40960, 100000, 200000, 400000, 700000, 1*MEG,          /* 12-19 */
  94. X2*MEG,3*MEG,4*MEG,5*MEG,6*MEG,8*MEG,10*MEG,                          /* 20-26 */
  95. X12*MEG,14*MEG,16*MEG,18*MEG,20*MEG,22*MEG,24*MEG,26*MEG,28*MEG,      /* 27-35 */
  96. X30*MEG,32*MEG,34*MEG,36*MEG,38*MEG,40*MEG,42*MEG,44*MEG,46*MEG,      /* 36-44 */
  97. X48*MEG,50*MEG,52*MEG,54*MEG,56*MEG,58*MEG,60*MEG,62*MEG,64*MEG,      /* 45-53 */
  98. X66*MEG,68*MEG,70*MEG,72*MEG,74*MEG,76*MEG,78*MEG,80*MEG,82*MEG,      /* 54-62 */
  99. X84*MEG,86*MEG,88*MEG,90*MEG,92*MEG,94*MEG,96*MEG,98*MEG,100*MEG,     /* 63-71 */
  100. X105*MEG,110*MEG,115*MEG,120*MEG, 125*MEG, 130*MEG, 135*MEG, 140*MEG, /* 72-79 */
  101. X145*MEG,150*MEG,155*MEG,160*MEG, 165*MEG, 170*MEG, 175*MEG, 180*MEG, /* 80-87 */
  102. X185*MEG,190*MEG,195*MEG,200*MEG, 210*MEG, 220*MEG, 230*MEG, 240*MEG, /* 88-95 */
  103. X250*MEG,260*MEG,270*MEG,280*MEG, 290*MEG, 300*MEG                    /* 96-101*/
  104. X};
  105. X#undef MEG
  106. X
  107. Xchar *lpbuf,*lpnt,*inbuffer,*lpend; /* input/output pointers to the buffers */
  108. X# ifdef MSDOS
  109. XRAMBLOCK *ramblks;
  110. XDISKBLOCK *diskblks;
  111. X# else
  112. Xstruct cel *cell;   /*  pointer to the dungeon storage  */
  113. X# endif
  114. Xshort hitp[MAXX][MAXY];     /*  monster hp on level     */
  115. Xshort iarg[MAXX][MAXY]; /*  arg for the item array  */
  116. Xchar item[MAXX][MAXY];  /*  objects in maze if any  */
  117. Xchar know[MAXX][MAXY];  /*  1 or 0 if here before   */
  118. Xchar mitem[MAXX][MAXY]; /*  monster item array      */
  119. Xchar stealth[MAXX][MAXY];   /*  0=sleeping 1=awake monst*/
  120. Xchar iven[26];          /*  inventory for player            */
  121. Xshort ivenarg[26];      /*  inventory for player            */
  122. Xchar lastmonst[40];     /*  this has the name of the current monster    */
  123. Xchar beenhere[MAXLEVEL+MAXVLEVEL];  /*  1 if have been on this level */
  124. Xchar VERSION=VER;   /*  this is the present version # of the program    */
  125. Xchar SUBVERSION=SUBVER;
  126. Xchar nosignal=0;    /* set to 1 to disable the signals from doing anything */
  127. Xchar predostuff=0;  /*  2 means that the trap handling routines must do a
  128. X                        showplayer() after a trap.  0 means don't showplayer()
  129. X                        0 - we are in create player screen
  130. X                        1 - we are in welcome screen
  131. X                        2 - we are in the normal game   */
  132. Xchar loginname[20];     /* players login name */
  133. Xchar logname[LOGNAMESIZE];  /* players name storage for scoring             */
  134. Xchar sex=1;             /*  default is a man  0=woman                       */
  135. Xchar boldon=1;          /*  1=bold objects  0=inverse objects               */
  136. Xchar ckpflag=0;         /*  1 if want checkpointing of game, 0 otherwise    */
  137. Xchar cheat=0;           /*  1 if the player has fudged save file            */
  138. Xchar level=0;           /*  cavelevel player is on = c[CAVELEVEL]           */
  139. Xchar wizard=0;          /*  the wizard mode flag                            */
  140. Xshort lastnum=0;        /* the number of the monster last hitting player    */
  141. Xshort hitflag=0;        /*  flag for if player has been hit when running    */
  142. Xshort hit2flag=0;       /*  flag for if player has been hit when running    */
  143. Xshort hit3flag=0;       /*  flag for if player has been hit flush input     */
  144. Xshort playerx,playery;  /*  the room on the present level of the player     */
  145. Xshort lastpx,lastpy;    /*  0 --- MAXX-1  or  0 --- MAXY-1                  */
  146. Xshort oldx,oldy;
  147. Xchar  prayed = 1;       /* did player pray at an altar (command mode)? needs
  148. X                           to be saved, but I don't want to add incompatibility
  149. X                           right now.  KBR 1/11/90 */
  150. Xshort lasthx=0,lasthy=0;/* location of monster last hit by player       */
  151. Xshort nobeep=0;         /* true if program is not to beep                   */
  152. Xunsigned long lrandx=33601;  /*  the random number seed                      */
  153. Xlong initialtime=0;         /* time playing began                           */
  154. Xlong gtime=0;               /*  the clock for the game                      */
  155. Xlong outstanding_taxes=0;   /* present tax bill from score file             */
  156. Xlong c[100],cbak[100];      /*  the character description arrays            */
  157. Xint enable_scroll=0;        /* constant for enabled/disabled scrolling regn */
  158. Xchar aborted[] = " aborted";
  159. Xstruct sphere *spheres=0; /*pointer to linked list for spheres of annihilation*/
  160. Xchar *levelname[]=
  161. X{ " H"," 1"," 2"," 3"," 4"," 5"," 6"," 7"," 8"," 9","10","V1","V2","V3" };
  162. X
  163. Xchar original_objnamelist[]=".ATOP<^F&^+M=>^$$f*OD#~][[)))(((||||||||{?!BC}o:;,@@@@EVV))([[]]](^.[H***.^^.S.tsTLc,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,";
  164. Xchar hacklike_objnamelist[]=".:\\_^<_{%^6|2>_55}$'+#~[[[))))))========-?!?&~~~~~****899)))[[[[[)^.[1$$$.^^.3./0\\4,____________________________________________";
  165. Xchar objnamelist[MAXOBJECT+1];
  166. Xchar monstnamelist[]=".BGHJKOScjtAELNQRZabhiCTYdegmvzFWflorXV.pqsyUkMwDDPxnDDuD........,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,";
  167. Xchar floorc = '.';
  168. Xchar wallc = '#';
  169. Xchar boldobjects = FALSE ;
  170. Xchar auto_pickup = FALSE ;
  171. X
  172. X# ifdef MSDOS
  173. X  int DECRainbow, keypad;
  174. X# endif
  175. X
  176. Xchar *objectname[]=
  177. X{ 0,"a holy altar","a handsome jewel encrusted throne","the orb","a pit",
  178. X  "a staircase leading upwards","an elevator going up","a bubbling fountain",
  179. X  "a great marble statue","a teleport trap","the college of Larn",
  180. X  "a mirror","the DND store","a staircase going down","an elevator going down",
  181. X  "the bank of Larn","the 5th branch of the Bank of Larn",
  182. X  "a dead fountain","gold","an open door","a closed door",
  183. X  "a wall","The Eye of Larn","plate mail","chain mail","leather armor",
  184. X  "a sword of slashing","Bessman's flailing hammer","a sunsword",
  185. X  "a two handed sword","a spear","a dagger",
  186. X  "ring of extra regeneration","a ring of regeneration","a ring of protection",
  187. X  "an energy ring","a ring of dexterity","a ring of strength",
  188. X  "a ring of cleverness","a ring of increase damage","a belt of striking",
  189. X  "a magic scroll","a magic potion","a book","a chest",
  190. X  "an amulet of invisibility","an orb of dragon slaying",
  191. X  "a scarab of negate spirit","a cube of undead control",
  192. X  "device of theft prevention","a brilliant diamond","a ruby",
  193. X  "an enchanting emerald","a sparkling sapphire","the dungeon entrance",
  194. X  "a volcanic shaft leaning downward","the base of a volcanic shaft",
  195. X  "a battle axe","a longsword","a flail","ring mail","studded leather armor",
  196. X  "splint mail","plate armor","stainless plate armor","a lance of death",
  197. X  "an arrow trap","an arrow trap","a shield","your home",
  198. X  "gold","gold","gold","a dart trap",
  199. X  "a dart trap","a trapdoor","a trapdoor","the local trading post",
  200. X  "a teleport trap", "a massive throne",
  201. X  "a sphere of annihilation","a handsome jewel encrusted throne",
  202. X  "the Larn Revenue Service","a fortune cookie","","","","","","",
  203. X  "","","","","","","","","","","","","","","","","","","",""
  204. X };
  205. X
  206. X
  207. X/*
  208. X *  for the monster data
  209. X *
  210. X *  array to do rnd() to create monsters <= a given level
  211. X */
  212. Xchar monstlevel[] = { 5, 11, 17, 22, 27, 33, 39, 42, 46, 50, 53, 56, 59 };
  213. X
  214. Xstruct monst monster[] = {
  215. X/*  NAME            LV  AC  DAM ATT DEF GEN INT GOLD    HP  EXP
  216. X----------------------------------------------------------------- */
  217. X{ "",               0,  0,  0,  0,  0,   0,  3,   0,    0,  0   },
  218. X{ "bat",            1,  0,  1,  0,  0,   0,  3,   0,    1,  1   },
  219. X{ "gnome",          1,  10, 1,  0,  0,   0,  8,  30,    2,  2   },
  220. X{ "hobgoblin",      1,  14, 2,  0,  0,   0,  5,  25,    3,  2   },
  221. X{ "jackal",         1,  17, 1,  0,  0,   0,  4,   0,    1,  1   },
  222. X{ "kobold",         1,  20, 1,  0,  0,   0,  7,  10,    1,  1   },
  223. X
  224. X{ "orc",            2,  12, 1,  0,  0,   0,  9,  40,    4,  2   },
  225. X{ "snake",          2,  15, 1,  0,  0,   0,  3,   0,    3,  1   },
  226. X{ "giant centipede",2,  14, 0,  4,  0,   0,  3,   0,    1,  2   },
  227. X{ "jaculi",         2,  20, 1,  0,  0,   0,  3,   0,    2,  1   },
  228. X{ "troglodyte",     2,  10, 2,  0,  0,   0,  5,  80,    4,  3   },
  229. X{ "giant ant",      2,  8,  1,  4,  0,   0,  4,   0,    5,  5   },
  230. X
  231. X/*  NAME            LV  AC  DAM ATT DEF GEN INT GOLD    HP  EXP
  232. X----------------------------------------------------------------- */
  233. X
  234. X{ "floating eye",   3,  8,  1,  0,  0,   0,  3,   0,     5,  2  },
  235. X{ "leprechaun",     3,  3,  0,  8,  0,   0,  3,1500,    13, 45  },
  236. X{ "nymph",          3,  3,  0,  14, 0,   0,  9,   0,    18, 45  },
  237. X{ "quasit",         3,  5,  3,  0,  0,   0,  3,   0,    10, 15  },
  238. X{ "rust monster",   3,  4,  0,  1,  0,   0,  3,   0,    18, 25  },
  239. X{ "zombie",         3,  12, 2,  0,  0,   0,  3,   0,     6,  7  },
  240. X
  241. X{ "assassin bug",   4,  9,  3,  0,  0,   0,  3,   0,    20, 15  },
  242. X{ "bugbear",        4,  5,  4,  15, 0,   0,  5,  40,    20, 35  },
  243. X{ "hell hound",     4,  5,  2,  2,  0,   0,  6,   0,    16, 35  },
  244. X{ "ice lizard",     4,  11, 2,  10, 0,   0,  6,  50,    16, 25  },
  245. X{ "centaur",        4,  6,  4,  0,  0,   0, 10,  40,    24, 45  },
  246. X
  247. X/*  NAME            LV  AC  DAM ATT DEF GEN INT GOLD    HP  EXP
  248. X----------------------------------------------------------------- */
  249. X
  250. X{ "troll",          5,  4,  5,  0,  0,   0,  9,  80,    50, 300 },
  251. X{ "yeti",           5,  6,  4,  0,  0,   0,  5,  50,    35, 100 },
  252. X{ "white dragon",   5,  2,  4,  5,  0,   0, 16, 500,    55, 1000},
  253. X{ "elf",            5,  8,  1,  0,  0,   0, 15,  50,    22, 35  },
  254. X{ "gelatinous cube",5,  9,  1,  0,  0,   0,  3,   0,    22, 45  },
  255. X
  256. X{ "metamorph",      6,  7,  3,  0,  0,   0,  3,  0,     30, 40  },
  257. X{ "vortex",         6,  4,  3,  0,  0,   0,  3,  0,     30, 55  },
  258. X{ "ziller",         6,  15, 3,  0,  0,   0,  3,  0,     30, 35  },
  259. X{ "violet fungi",   6,  12, 3,  0,  0,   0,  3,  0,     38, 100 },
  260. X{ "wraith",         6,  3,  1,  6,  0,   0,  3,  0,     30, 325 },
  261. X{ "forvalaka",      6,  2,  5,  0,  0,   0,  7,  0,     50, 280 },
  262. X
  263. X/*  NAME            LV  AC  DAM ATT DEF GEN INT GOLD    HP  EXP
  264. X----------------------------------------------------------------- */
  265. X
  266. X{ "lama nobe",      7,  7,  3,  0,  0,   0,  6,  0,     35, 80  },
  267. X{ "osequip",        7,  4,  3,  16, 0,   0,  4,  0,     35, 100 },
  268. X{ "rothe",          7,  15, 5,  0,  0,   0,  3,  100,   50, 250 },
  269. X{ "xorn",           7,  0,  6,  0,  0,   0, 13,  0,     60, 300 },
  270. X{ "vampire",        7,  3,  4,  6,  0,   0, 17,  0,     50, 1000},
  271. X{ "invisible stalker",7,3,  6,  0,  0,   0,  5,  0,     50, 350 },
  272. X
  273. X{ "poltergeist",    8,  1,  4,  0,  0,   0,  3,  0,     50, 450 },
  274. X{ "disenchantress", 8,  3,  0,  9,  0,   0,  3,  0,     50, 500 },
  275. X{ "shambling mound",8,  2,  5,  0,  0,   0,  6,  0,     45, 400 },
  276. X{ "yellow mold",    8,  12, 4,  0,  0,   0,  3,  0,     35, 250 },
  277. X{ "umber hulk",     8,  3,  7,  11, 0,   0, 14,  0,     65, 600 },
  278. X
  279. X/*  NAME            LV  AC  DAM ATT DEF GEN INT GOLD    HP  EXP
  280. X----------------------------------------------------------------- */
  281. X
  282. X{ "gnome king",     9,  -1, 10, 0,  0,   0, 18,  2000,  100,3000    },
  283. X{ "mimic",          9,   5, 6,  0,  0,   0,  8,  0,     55, 99      },
  284. X{ "water lord",     9, -10, 15, 7,  0,   0, 20,  0,     150,15000   },
  285. X{ "bronze dragon",  9,   2, 9,  3,  0,   0, 16,  300,   80, 4000    },
  286. X{ "green dragon",   9,   3, 8,  10, 0,   0, 15,  200,   70, 2500    },
  287. X{ "purple worm",    9,  -1, 11, 0,  0,   0,  3,  100,   120,15000   },
  288. X{ "xvart",          9,  -2, 12, 0,  0,   0, 13,  0,     90, 1000    },
  289. X
  290. X{ "spirit naga",    10, -20,12, 12, 0,   0, 23,  0,     95, 20000   },
  291. X{ "silver dragon",  10, -1, 12, 3,  0,   0, 20,  700,   100,10000   },
  292. X{ "platinum dragon",10, -5, 15, 13, 0,   0, 22,  1000,  130,24000   },
  293. X{ "green urchin",   10, -3, 12, 0,  0,   0,  3,  0,     85, 5000    },
  294. X{ "red dragon",     10, -2, 13, 3,  0,   0, 19,  800,   110,14000   },
  295. X
  296. X{ "type I demon lord",  12,-30, 18, 0,   0,  0, 20, 0,  140,50000   },
  297. X{ "type II demon lord", 13,-30, 18, 0,   0,  0, 21, 0,  160,75000   },
  298. X{ "type III demon lord",14,-30, 18, 0,   0,  0, 22, 0,  180,100000  },
  299. X{ "type IV demon lord", 15,-35, 20, 0,   0,  0, 23, 0,  200,125000  },
  300. X{ "type V demon lord",  16,-40, 22, 0,   0,  0, 24, 0,  220,150000  },
  301. X{ "type VI demon lord", 17,-45, 24, 0,   0,  0, 25, 0,  240,175000  },
  302. X{ "type VII demon lord",18,-70, 27, 6,   0,  0, 26, 0,  260,200000  },
  303. X{ "demon prince",       25,-127,30, 6,   0,  0, 28, 0,  345,300000  }
  304. X
  305. X/*  NAME                LV  AC  DAM ATT DEF GEN INT GOLD    HP  EXP
  306. X--------------------------------------------------------------------- */
  307. X };
  308. X
  309. X/*  name array for scrolls      */
  310. X
  311. Xchar *scrollname[] = {
  312. X"\0enchant armor",
  313. X"\0enchant weapon",
  314. X"\0enlightenment",
  315. X"\0blank paper",
  316. X"\0create monster",
  317. X"\0create artifact",
  318. X"\0aggravate monsters",
  319. X"\0time warp",
  320. X"\0teleportation",
  321. X"\0expanded awareness",
  322. X"\0haste monsters",
  323. X"\0monster healing",
  324. X"\0spirit protection",
  325. X"\0undead protection",
  326. X"\0stealth",
  327. X"\0magic mapping",
  328. X"\0hold monsters",
  329. X"\0gem perfection",
  330. X"\0spell extension",
  331. X"\0identify",
  332. X"\0remove curse",
  333. X"\0annihilation",
  334. X"\0pulverization",
  335. X"\0life protection",
  336. X"\0 ",
  337. X"\0 ",
  338. X"\0 ",
  339. X"\0 "
  340. X };
  341. X
  342. X/*  name array for magic potions    */
  343. Xchar *potionname[] = {
  344. X"\0sleep",
  345. X"\0healing",
  346. X"\0raise level",
  347. X"\0increase ability",
  348. X"\0wisdom",
  349. X"\0strength",
  350. X"\0raise charisma",
  351. X"\0dizziness",
  352. X"\0learning",
  353. X"\0gold detection",
  354. X"\0monster detection",
  355. X"\0forgetfulness",
  356. X"\0water",
  357. X"\0blindness",
  358. X"\0confusion",
  359. X"\0heroism",
  360. X"\0sturdiness",
  361. X"\0giant strength",
  362. X"\0fire resistance",
  363. X"\0treasure finding",
  364. X"\0instant healing",
  365. X" cure dianthroritis",
  366. X"\0poison",
  367. X"\0see invisible",
  368. X"\0 ",
  369. X"\0 ",
  370. X"\0 ",
  371. X"\0 ",
  372. X"\0 ",
  373. X"\0 ",
  374. X"\0 ",
  375. X"\0 ",
  376. X"\0 ",
  377. X"\0 ",
  378. X"\0 "
  379. X };
  380. X
  381. X
  382. X/*
  383. X    spell data
  384. X */
  385. Xchar spelknow[SPNUM];
  386. Xchar splev[] = { 1, 4, 9, 14, 18, 22, 26, 29, 32, 35, 37, 37, 37, 37, 37 };
  387. X
  388. Xchar *spelcode[]={
  389. X    "pro",  "mle",  "dex",  "sle",  "chm",  "ssp",
  390. X    "web",  "str",  "enl",  "hel",  "cbl",  "cre",  "pha",  "inv",
  391. X    "bal",  "cld",  "ply",  "can",  "has",  "ckl",  "vpr",
  392. X    "dry",  "lit",  "drl",  "glo",  "flo",  "fgr",
  393. X    "sca",  "hld",  "stp",  "tel",  "mfi", /* 31 */
  394. X    "sph",  "gen",  "sum",  "wtw",  "alt",  "per"
  395. X };
  396. X
  397. Xchar *spelname[]={
  398. X    "protection",               "magic missile",        "dexterity",
  399. X    "sleep",                    "charm monster",        "sonic spear",
  400. X
  401. X    "web",                      "strength",             "enlightenment",
  402. X    "healing",                  "cure blindness",       "create monster",
  403. X    "phantasmal forces",        "invisibility",
  404. X
  405. X    "fireball",                 "cold",                 "polymorph",
  406. X    "cancellation",             "haste self",           "cloud kill",
  407. X    "vaporize rock",
  408. X
  409. X    "dehydration",              "lightning",            "drain life",
  410. X    "invulnerability",          "flood",                "finger of death",
  411. X
  412. X    "scare monster",            "hold monster",         "time stop",
  413. X    "teleport away",            "magic fire",
  414. X
  415. X    "sphere of annihilation",   "genocide",             "summon demon",
  416. X    "walk through walls",       "alter reality",        "permanence",
  417. X    ""
  418. X };
  419. X
  420. Xchar *speldescript[]={
  421. X/* 1 */
  422. X    "generates a +2 protection field",
  423. X    "creates and hurls a magic missile equivalent to a + 1 magic arrow",
  424. X    "adds +2 to the casters dexterity",
  425. X    "causes some monsters to go to sleep",
  426. X    "some monsters may be awed at your magnificence",
  427. X    "causes your hands to emit a screeching sound toward what they point",
  428. X/* 7 */
  429. X    "causes strands of sticky thread to entangle an enemy",
  430. X    "adds +2 to the casters strength for a short term",
  431. X    "the caster becomes aware of things around him",
  432. X    "restores some hp to the caster",
  433. X    "restores sight to one so unfortunate as to be blinded",
  434. X    "creates a monster near the caster appropriate for the location",
  435. X    "creates illusions, and if believed, monsters die",
  436. X    "the caster becomes invisible",
  437. X/* 15 */
  438. X    "makes a ball of fire that burns on what it hits",
  439. X    "sends forth a cone of cold which freezes what it touches",
  440. X    "you can find out what this does for yourself",
  441. X    "negates the ability of a monster to use his special abilities",
  442. X    "speeds up the casters movements",
  443. X    "creates a fog of poisonous gas which kills all that is within it",
  444. X    "this changes rock to air",
  445. X/* 22 */
  446. X    "dries up water in the immediate vicinity",
  447. X    "you finger will emit a lightning bolt when this spell is cast",
  448. X    "subtracts hit points from both you and a monster",
  449. X    "this globe helps to protect the player from physical attack",
  450. X    "this creates an avalanche of H2O to flood the immediate chamber",
  451. X    "this is a holy spell and calls upon your god to back you up",
  452. X/* 28 */
  453. X    "terrifies the monster so that hopefully he wont hit the magic user",
  454. X    "the monster is frozen in his tracks if this is successful",
  455. X    "all movement in the caverns ceases for a limited duration",
  456. X    "moves a particular monster around in the dungeon (hopefully away from you)",
  457. X    "this causes a curtain of fire to appear all around you",
  458. X/* 33 */
  459. X    "anything caught in this sphere is instantly killed.  Warning -- dangerous",
  460. X    "eliminates a species of monster from the game -- use sparingly",
  461. X    "summons a demon who hopefully helps you out",
  462. X    "allows the player to walk through walls for a short period of time",
  463. X    "god only knows what this will do",
  464. X    "makes a character spell permanent, i. e. protection, strength, etc.",
  465. X    ""
  466. X };
  467. X
  468. Xchar spelweird[MAXMONST+8][SPNUM] = {
  469. X/*                      p m d s c s    w s e h c c p i    b c p c h c v    d l d g f f    s h s t m    s g s w a p */
  470. X/*                      r l e l h s    e t n e b r h n    a l l a a k p    r i r l l g    c l t e f    p e u t l e */
  471. X/*                      o e x e m p    b r l l l e a v    l d y n s l r    y t l o o r    a d p l i    h n m w t r */
  472. X    
  473. X
  474. X/*            bat */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  475. X/*          gnome */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,5,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  476. X/*      hobgoblin */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  477. X/*         jackal */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  478. X/*         kobold */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,5,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  479. X
  480. X/*            orc */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   4,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  481. X/*          snake */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  482. X/*giant centipede */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  483. X/*         jaculi */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  484. X/*     troglodyte */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  485. X
  486. X/*      giant ant */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  487. X/*   floating eye */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  488. X/*     leprechaun */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  489. X/*          nymph */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  490. X/*         quasit */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  491. X
  492. X/*   rust monster */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   4,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  493. X/*         zombie */ {  0,0,0,8,0,4,   0,0,0,0,0,0,0,0,   0,0,0,0,0,4,0,   4,0,0,0,0,4,   0,0,0,0,0,   0,0,0,0,0,0 },
  494. X/*   assassin bug */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  495. X/*        bugbear */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,5,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  496. X/*     hell hound */ {  0,6,0,0,0,0,   12,0,0,0,0,0,0,0,  0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  497. X
  498. X/*     ice lizard */ {  0,0,0,0,0,0,   11,0,0,0,0,0,0,0,  0,15,0,0,0,0,0,  0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  499. X/*        centaur */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  500. X/*          troll */ {  0,7,0,0,0,0,   0,0,0,0,0,0,0,5,   0,0,0,0,0,0,0,   4,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  501. X/*           yeti */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,15,0,0,0,0,0,  0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  502. X/*   white dragon */ {  0,0,0,0,0,0,   0,0,0,0,0,0,14,0,  0,15,0,0,0,0,0,  4,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  503. X
  504. X/*            elf */ {  0,0,0,0,0,0,   0,0,0,0,0,0,14,5,  0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  505. X/*gelatinous cube */ {  0,0,0,0,0,0,   2,0,0,0,0,0,0,0,   0,0,0,0,0,4,0,   0,0,0,0,0,4,   0,0,0,0,0,   0,0,0,0,0,0 },
  506. X/*      metamorph */ {  0,13,0,0,0,0,  2,0,0,0,0,0,0,0,   0,0,0,0,0,4,0,   4,0,0,0,0,4,   0,0,0,0,0,   0,0,0,0,0,0 },
  507. X/*         vortex */ {  0,13,0,0,0,10, 1,0,0,0,0,0,0,0,   0,0,0,0,0,4,0,   4,0,0,0,4,4,   0,0,0,0,0,   0,0,0,0,0,0 },
  508. X/*         ziller */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  509. X
  510. X/*   violet fungi */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  511. X/*         wraith */ {  0,0,0,8,0,4,   0,0,0,0,0,0,0,0,   0,0,0,0,0,4,0,   4,0,0,0,0,4,   0,0,0,0,0,   0,0,0,0,0,0 },
  512. X/*      forvalaka */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,5,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  513. X/*      lama nobe */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  514. X/*        osequip */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  515. X
  516. X/*          rothe */ {  0,7,0,0,0,0,   0,0,0,0,0,0,0,5,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  517. X/*           xorn */ {  0,7,0,0,0,0,   0,0,0,0,0,0,0,5,   0,0,0,0,0,0,0,   4,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  518. X/*        vampire */ {  0,0,0,8,0,4,   0,0,0,0,0,0,0,0,   0,0,0,0,0,4,0,   0,0,0,0,0,4,   0,0,0,0,0,   0,0,0,0,0,0 },
  519. X/*invisible staker*/ {  0,0,0,0,0,0,   1,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  520. X/*    poltergeist */ {  0,13,0,8,0,4,  1,0,0,0,0,0,0,0,   0,4,0,0,0,4,0,   4,0,0,0,4,4,   0,0,0,0,0,   0,0,0,0,0,0 },
  521. X
  522. X/* disenchantress */ {  0,0,0,8,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  523. X/*shambling mound */ {  0,0,0,0,0,10,  0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  524. X/*    yellow mold */ {  0,0,0,8,0,0,   1,0,0,0,0,0,4,0,   0,0,0,0,0,4,0,   0,0,0,0,0,4,   0,0,0,0,0,   0,0,0,0,0,0 },
  525. X/*     umber hulk */ {  0,7,0,0,0,0,   0,0,0,0,0,0,0,5,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  526. X/*     gnome king */ {  0,7,0,0,3,0,   0,0,0,0,0,0,0,5,   0,0,9,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  527. X
  528. X/*          mimic */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  529. X/*     water lord */ {  0,13,0,8,3,4,  1,0,0,0,0,0,0,0,   0,0,9,0,0,4,0,   0,0,0,0,16,4,  0,0,0,0,0,   0,0,0,0,0,0 },
  530. X/*  bronze dragon */ {  0,7,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  531. X/*   green dragon */ {  0,7,0,0,0,0,   11,0,0,0,0,0,0,0,  0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  532. X/*    purple worm */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  533. X
  534. X/*          xvart */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  535. X/*    spirit naga */ {  0,13,0,8,3,4,  1,0,0,0,0,0,0,5,   0,4,9,0,0,4,0,   4,0,0,0,4,4,   0,0,0,0,0,   0,0,0,0,0,0 },
  536. X/*  silver dragon */ {  0,6,0,9,0,0,   12,0,0,0,0,0,0,0,  0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  537. X/*platinum dragon */ {  0,7,0,9,0,0,   11,0,0,0,0,0,14,0, 0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  538. X/*   green urchin */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  539. X/*     red dragon */ {  0,6,0,0,0,0,   12,0,0,0,0,0,0,0,  0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
  540. X
  541. X/*                      p m d s c s    w s e h c c p i    b c p c h c v    d l d g f f    s h s t m    s g s w a p */
  542. X/*                      r l e l h s    e t n e b r h n    a l l a a k p    r i r l l g    c l t e f    p e u t l e */
  543. X/*                      o e x e m p    b r l l l e a v    l d y n s l r    y t l o o r    a d p l i    h n m w t r */
  544. X
  545. X/*     demon lord */ {  0,7,0,4,3,0,   1,0,0,0,0,0,14,5,  0,0,4,0,0,4,0,   4,0,0,0,4,4,   0,0,0,0,0,   9,0,0,0,0,0 },
  546. X/*     demon lord */ {  0,7,0,4,3,0,   1,0,0,0,0,0,14,5,  0,0,4,0,0,4,0,   4,0,0,0,4,4,   0,0,0,0,0,   9,0,0,0,0,0 },
  547. X/*     demon lord */ {  0,7,0,4,3,0,   1,0,0,0,0,0,14,5,  0,0,4,0,0,4,0,   4,0,0,0,4,4,   0,0,0,0,0,   9,0,0,0,0,0 },
  548. X/*     demon lord */ {  0,7,0,4,3,0,   1,0,0,0,0,0,14,5,  0,0,4,0,0,4,0,   4,0,0,0,4,4,   0,0,0,0,0,   9,0,0,0,0,0 },
  549. X/*     demon lord */ {  0,7,0,4,3,0,   1,0,0,0,0,0,14,5,  0,0,4,0,0,4,0,   4,0,0,0,4,4,   0,0,0,0,0,   9,0,0,0,0,0 },
  550. X/*     demon lord */ {  0,7,0,4,3,0,   1,0,0,0,0,0,14,5,  0,0,4,0,0,4,0,   4,0,0,0,4,4,   0,0,0,0,0,   9,0,0,0,0,0 },
  551. X/*     demon lord */ {  0,7,0,4,3,0,   1,0,0,0,0,0,14,5,  0,0,4,0,0,4,0,   4,0,0,0,4,4,   0,0,0,0,0,   9,0,0,0,0,0 },
  552. X/*   demon prince */ {  0,7,0,4,3,9,   1,0,0,0,0,0,14,5,  0,0,4,0,0,4,0,   4,0,0,0,4,4,   4,0,0,0,4,   9,0,0,0,0,0 }
  553. X
  554. X };
  555. X
  556. Xchar *spelmes[] = { "",
  557. X/*  1 */    "the web had no effect on the %s",
  558. X/*  2 */    "the %s changed shape to avoid the web",
  559. X/*  3 */    "the %s isn't afraid of you",
  560. X/*  4 */    "the %s isn't affected",
  561. X/*  5 */    "the %s can see you with his infravision",
  562. X/*  6 */    "the %s vaporizes your missile",
  563. X/*  7 */    "your missile bounces off the %s",
  564. X/*  8 */    "the %s doesn't sleep",
  565. X/*  9 */    "the %s resists",
  566. X/* 10 */    "the %s can't hear the noise",
  567. X/* 11 */    "the %s's tail cuts it free of the web",
  568. X/* 12 */    "the %s burns through the web",
  569. X/* 13 */    "your missiles pass right through the %s",
  570. X/* 14 */    "the %s sees through your illusions",
  571. X/* 15 */    "the %s loves the cold!",
  572. X/* 16 */    "the %s loves the water!"
  573. X };
  574. X
  575. X/*
  576. X *  function to create scroll numbers with appropriate probability of 
  577. X *  occurrence
  578. X *
  579. X *  0 - armor           1 - weapon      2 - enlightenment   3 - paper
  580. X *  4 - create monster  5 - create item 6 - aggravate       7 - time warp
  581. X *  8 - teleportation   9 - expanded awareness              10 - haste monst
  582. X *  11 - heal monster   12 - spirit protection      13 - undead protection
  583. X *  14 - stealth        15 - magic mapping          16 - hold monster
  584. X *  17 - gem perfection 18 - spell extension        19 - identify
  585. X *  20 - remove curse   21 - annihilation           22 - pulverization
  586. X *  23 - life protection
  587. X */
  588. Xchar scprob[]= { 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3,
  589. X    3, 3, 3, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9,
  590. X    9, 9, 10, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 13, 14, 14,
  591. X    15, 15, 16, 16, 16, 17, 17, 18, 18, 19, 19, 19, 20, 20, 20, 20, 21, 22,
  592. X    22, 22, 23 };
  593. X
  594. X/*
  595. X *  function to return a potion number created with appropriate probability
  596. X *  of occurrence
  597. X *
  598. X *  0 - sleep               1 - healing                 2 - raise level
  599. X *  3 - increase ability    4 - gain wisdom             5 - gain strength
  600. X *  6 - charismatic character   7 - dizziness           8 - learning
  601. X *  9 - gold detection      10 - monster detection      11 - forgetfulness
  602. X *  12 - water              13 - blindness              14 - confusion
  603. X *  15 - heroism            16 - sturdiness             17 - giant strength
  604. X *  18 - fire resistance    19 - treasure finding       20 - instant healing
  605. X *  21 - cure dianthroritis 22 - poison                 23 - see invisible
  606. X */
  607. Xchar potprob[] = { 0, 0, 1, 1, 1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 9, 9, 9, 10, 10, 10, 11, 11, 12, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 20, 22, 22, 23, 23 };
  608. X
  609. Xchar nlpts[] = { 0, 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 5, 6, 7 };
  610. Xchar nch[] = { 0, 0, 0, 1, 1, 1, 2, 2, 3, 4 };
  611. Xchar nplt[] = { 0, 0, 0, 0, 1, 1, 2, 2, 3, 4 };
  612. Xchar ndgg[] = { 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 4, 5 };
  613. Xchar nsw[] = { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 3 };
  614. END_OF_FILE
  615. if test 31189 -ne `wc -c <'data.c'`; then
  616.     echo shar: \"'data.c'\" unpacked with wrong size!
  617. fi
  618. # end of 'data.c'
  619. fi
  620. if test -f 'display.c' -a "${1}" != "-c" ; then 
  621.   echo shar: Will not clobber existing file \"'display.c'\"
  622. else
  623. echo shar: Extracting \"'display.c'\" \(18900 characters\)
  624. sed "s/^X//" >'display.c' <<'END_OF_FILE'
  625. X/*  display.c       Larn is copyrighted 1986 by Noah Morgan. */
  626. X#include "header.h"
  627. X
  628. X#define botsub( _idx, _x, _y, _str )        \
  629. X    if ( c[(_idx)] != cbak[(_idx)] )        \
  630. X    {                                   \
  631. X    cbak[(_idx)] = c[(_idx)];           \
  632. X    cursor( (_x), (_y) );               \
  633. X    lprintf( (_str), (long)c[(_idx)] ); \
  634. X    }
  635. X
  636. Xstatic int minx,maxx,miny,maxy,k,m;
  637. Xstatic char bot1f=0,bot2f=0,bot3f=0;
  638. Xstatic char always=0;
  639. X/*
  640. X    bottomline()
  641. X
  642. X    now for the bottom line of the display
  643. X */
  644. Xbottomline()
  645. X    {   recalc();   bot1f=1;    }
  646. Xbottomhp()
  647. X    {   bot2f=1;    }
  648. Xbottomspell()
  649. X    {   bot3f=1;    }
  650. Xbottomdo()
  651. X    {
  652. X    if (bot1f) { bot3f=bot1f=bot2f=0; bot_linex(); return; }
  653. X    if (bot2f) { bot2f=0; bot_hpx(); }
  654. X    if (bot3f) { bot3f=0; bot_spellx(); }
  655. X    }
  656. X
  657. Xbot_linex()
  658. X    {
  659. X    register int i;
  660. X    if (cbak[SPELLS] <= -50 || (always))
  661. X        {
  662. X        cursor( 1,18);
  663. X        if (c[SPELLMAX]>99)  lprintf("Spells:%3d(%3d)",(long)c[SPELLS],(long)c[SPELLMAX]);
  664. X                        else lprintf("Spells:%3d(%2d) ",(long)c[SPELLS],(long)c[SPELLMAX]);
  665. X        lprintf(" AC: %-3d  WC: %-3d  Level",(long)c[AC],(long)c[WCLASS]);
  666. X        if (c[LEVEL]>99) lprintf("%3d",(long)c[LEVEL]);
  667. X                    else lprintf(" %-2d",(long)c[LEVEL]);
  668. X        lprintf(" Exp: %-9d %s\n",(long)c[EXPERIENCE],class[c[LEVEL]-1]);
  669. X        lprintf("HP: %3d(%3d) STR=%-2d INT=%-2d ",
  670. X            (long)c[HP],(long)c[HPMAX],(long)(c[STRENGTH]+c[STREXTRA]),(long)c[INTELLIGENCE]);
  671. X        lprintf("WIS=%-2d CON=%-2d DEX=%-2d CHA=%-2d LV:",
  672. X            (long)c[WISDOM],(long)c[CONSTITUTION],(long)c[DEXTERITY],(long)c[CHARISMA]);
  673. X
  674. X        if ((level==0) || (wizard))  c[TELEFLAG]=0;
  675. X        if (c[TELEFLAG])  lprcat(" ?");  else  lprcat(levelname[level]);
  676. X        lprintf("  Gold: %-6d",(long)c[GOLD]);
  677. X        always=1;  botside();
  678. X        c[TMP] = c[STRENGTH]+c[STREXTRA];
  679. X        for (i=0; i<100; i++) cbak[i]=c[i];
  680. X        return;
  681. X        }
  682. X
  683. X    botsub(SPELLS,8,18,"%3d");
  684. X    if (c[SPELLMAX]>99)
  685. X        {
  686. X        botsub(SPELLMAX,12,18,"%3d)");
  687. X        }
  688. X    else
  689. X        botsub(SPELLMAX,12,18,"%2d) ");
  690. X    botsub(HP,5,19,"%3d");
  691. X    botsub(HPMAX,9,19,"%3d");
  692. X    botsub(AC,21,18,"%-3d");
  693. X    botsub(WCLASS,30,18,"%-3d");
  694. X    botsub(EXPERIENCE,49,18,"%-9d");
  695. X    if (c[LEVEL] != cbak[LEVEL])
  696. X        {
  697. X        cursor(59,18);
  698. X        lprcat(class[c[LEVEL]-1]);
  699. X        }
  700. X    if (c[LEVEL]>99)
  701. X        {
  702. X        botsub(LEVEL,40,18,"%3d");
  703. X        }
  704. X    else
  705. X        botsub(LEVEL,40,18," %-2d");
  706. X    c[TMP] = c[STRENGTH]+c[STREXTRA];
  707. X    botsub(TMP,18,19,"%-2d");
  708. X    botsub(INTELLIGENCE,25,19,"%-2d");
  709. X    botsub(WISDOM,32,19,"%-2d");
  710. X    botsub(CONSTITUTION,39,19,"%-2d");
  711. X    botsub(DEXTERITY,46,19,"%-2d");
  712. X    botsub(CHARISMA,53,19,"%-2d");
  713. X    if ((level != cbak[CAVELEVEL]) || (c[TELEFLAG] != cbak[TELEFLAG]))
  714. X        {
  715. X        if ((level==0) || (wizard))
  716. X            c[TELEFLAG]=0;
  717. X        cbak[TELEFLAG] = c[TELEFLAG];
  718. X        cbak[CAVELEVEL] = level;
  719. X        cursor(59,19);
  720. X        if (c[TELEFLAG])
  721. X            lprcat(" ?");
  722. X        else
  723. X            lprcat(levelname[level]);
  724. X        }
  725. X    botsub(GOLD,69,19,"%-6d");
  726. X    botside();
  727. X    }
  728. X
  729. X/*
  730. X    special subroutine to update only the gold number on the bottomlines
  731. X    called from ogold()
  732. X */
  733. Xbottomgold()
  734. X    {
  735. X    botsub(GOLD,69,19,"%-6d");
  736. X    }
  737. X
  738. X/*
  739. X    special routine to update hp and level fields on bottom lines
  740. X    called in monster.c hitplayer() and spattack()
  741. X */
  742. Xstatic bot_hpx()
  743. X    {
  744. X    if (c[EXPERIENCE] != cbak[EXPERIENCE])
  745. X        {
  746. X        recalc();
  747. X        bot_linex();
  748. X        }
  749. X    else
  750. X        botsub(HP,5,19,"%3d");
  751. X    }
  752. X
  753. X/*
  754. X    special routine to update number of spells called from regen()
  755. X */
  756. Xstatic bot_spellx()
  757. X    {
  758. X    botsub(SPELLS,9,18,"%2d");
  759. X    }
  760. X
  761. X/*
  762. X    common subroutine for a more economical bottomline()
  763. X */
  764. Xstatic struct bot_side_def
  765. X    {
  766. X    int typ;
  767. X    char *string;
  768. X    }
  769. X    bot_data[] =
  770. X    {
  771. X    STEALTH,"stealth",      UNDEADPRO,"undead pro",     SPIRITPRO,"spirit pro",
  772. X    CHARMCOUNT,"Charm",     TIMESTOP,"Time Stop",       HOLDMONST,"Hold Monst",
  773. X    GIANTSTR,"Giant Str",   FIRERESISTANCE,"Fire Resit", DEXCOUNT,"Dexterity",
  774. X    STRCOUNT,"Strength",    SCAREMONST,"Scare",         HASTESELF,"Haste Self",
  775. X    CANCELLATION,"Cancel",  INVISIBILITY,"Invisible",   ALTPRO,"Protect 3",
  776. X    PROTECTIONTIME,"Protect 2", WTW,"Wall-Walk"
  777. X    };
  778. X
  779. Xstatic botside()
  780. X    {
  781. X    register int i,idx;
  782. X    for (i=0; i<17; i++)
  783. X        {
  784. X        idx = bot_data[i].typ;
  785. X        if ((always) || (c[idx] != cbak[idx]))
  786. X           {
  787. X           if ((always) || (cbak[idx] == 0))
  788. X                { if (c[idx]) { cursor(70,i+1); lprcat(bot_data[i].string); } }  else
  789. X           if (c[idx]==0)     { cursor(70,i+1); lprcat("          "); }
  790. X           cbak[idx]=c[idx];
  791. X           }
  792. X        }
  793. X    always=0;
  794. X    }
  795. X
  796. X/*
  797. X *  subroutine to draw only a section of the screen
  798. X *  only the top section of the screen is updated.  If entire lines are being
  799. X *  drawn, then they will be cleared first.
  800. X */
  801. Xstatic int d_xmin=0,d_xmax=MAXX,d_ymin=0,d_ymax=MAXY;  /* for limited screen drawing */
  802. Xdraws(xmin,xmax,ymin,ymax)
  803. X    int xmin,xmax,ymin,ymax;
  804. X    {
  805. X    register int i,idx;
  806. X    if (xmin==0 && xmax==MAXX) /* clear section of screen as needed */
  807. X        {
  808. X        if (ymin==0) cl_up(79,ymax);
  809. X        else for (i=ymin; i<ymin; i++)  cl_line(1,i+1);
  810. X        xmin = -1;
  811. X        }
  812. X    d_xmin=xmin;    d_xmax=xmax;    d_ymin=ymin;    d_ymax=ymax;    /* for limited screen drawing */
  813. X    drawscreen();
  814. X    if (xmin<=0 && xmax==MAXX) /* draw stuff on right side of screen as needed*/
  815. X        {
  816. X        for (i=ymin; i<ymax; i++)
  817. X            {
  818. X            idx = bot_data[i].typ;
  819. X            if (c[idx])
  820. X                {
  821. X                cursor(70,i+1); lprcat(bot_data[i].string);
  822. X                }
  823. X            cbak[idx]=c[idx];
  824. X            }
  825. X        }
  826. X    }
  827. X
  828. X#ifdef DECRainbow
  829. X static int DECgraphics;     /* The graphics mode toggle */
  830. X
  831. X# define DECgraphicsON() if (!DECgraphics) lprc('\16'), DECgraphics = 1
  832. X# define DECgraphicsOFF() if (DECgraphics) lprc('\17'), DECgraphics = 0
  833. X
  834. X/* For debugging on a non-DEC
  835. X# define DECgraphicsON() if (!DECgraphics) lprcat("\33[4m"), DECgraphics = 1
  836. X# define DECgraphicsOFF() if (DECgraphics) lprcat("\33[0m"), DECgraphics = 0
  837. X*/
  838. X
  839. X# define DEClprc(ch)    if (ch & 0x80) {\
  840. X                            DECgraphicsON();\
  841. X                            lprc(ch ^ 0x80);\
  842. X                        } else {\
  843. X                            DECgraphicsOFF();\
  844. X                            lprc(ch);\
  845. X                        }
  846. X#define nlprc(_ch) DEClprc(_ch)
  847. X# else
  848. X#define nlprc(_ch) lprc(_ch)
  849. X#endif DECRainbow
  850. X
  851. X/*
  852. X    drawscreen()
  853. X
  854. X    subroutine to redraw the whole screen as the player knows it
  855. X */
  856. Xstatic char d_flag;
  857. Xdrawscreen()
  858. X    {
  859. X    register int i,j,k,ileft,iright;
  860. X    int lastx,lasty;  /* variables used to optimize the object printing */
  861. X    char    ch;
  862. X
  863. X    if (d_xmin==0 && d_xmax==MAXX && d_ymin==0 && d_ymax==MAXY)
  864. X        {
  865. X        d_flag=1;  clear(); /* clear the screen */
  866. X        }
  867. X    else
  868. X        {
  869. X        d_flag=0;  cursor(1,1);
  870. X        }
  871. X    if (d_xmin<0)
  872. X        d_xmin=0; /* d_xmin=-1 means display all without bottomline */
  873. X
  874. X    /* display lines of the screen
  875. X    */
  876. X    for ( j = d_ymin ; j < d_ymax ; j++ )
  877. X        {
  878. X        /* When we show a spot of the dungeon, we have 4 cases:
  879. X            squares we know nothing about
  880. X                - know == 0
  881. X            squares we've been at and still know whats there
  882. X                - know == KNOWALL (== KNOWHERE | HAVESEEN)
  883. X            squares we've been at, but don't still recall because
  884. X            something else happened there.
  885. X                - know == HAVESEEN
  886. X            squares we recall, but haven't been at (an error condition)
  887. X                - know == KNOWHERE
  888. X
  889. X           to minimize printing of spaces, scan from left of line until
  890. X           we reach a location that the user knows.
  891. X        */
  892. X        ileft = d_xmin - 1;
  893. X        while ( ++ileft < d_xmax )
  894. X            if (know[ileft][j])     /* instead of know[i][j] != 0 */
  895. X                break;              /* exitloop while */
  896. X
  897. X        /* if not a blank line ... */
  898. X        if ( ileft < d_xmax )
  899. X            {
  900. X            /* scan from right of line until we reach a location that the
  901. X               user knows.
  902. X            */
  903. X            iright = d_xmax ;
  904. X            while ( --iright > ileft )
  905. X                if (know[iright][j])
  906. X                    break ;    /* exitloop while */
  907. X
  908. X            /* now print the line, after positioning the cursor.
  909. X               print the line with bold objects in a different
  910. X               loop for effeciency
  911. X            */
  912. X            cursor( ileft+1, j+1 );
  913. X            if (boldobjects)
  914. X                for ( i=ileft ; i <= iright ; i++ )
  915. X
  916. X                    /* we still need to check for the location being known,
  917. X                       for we might have an unknown spot in the middle of
  918. X                       an otherwise known line.
  919. X                    */
  920. X                    if ( know[i][j] == 0 )
  921. X                        nlprc( ' ' );
  922. X                    else if ( know[i][j] & HAVESEEN )
  923. X                        {
  924. X                        /* if monster there and the user still knows the place,
  925. X                           then show the monster.  Otherwise, show what was
  926. X                           there before.
  927. X                        */
  928. X                        if (( k = mitem[i][j] ) &&
  929. X                            ( know[i][j] & KNOWHERE ))
  930. X                            nlprc( monstnamelist[k] );
  931. X                        else if (((k=item[i][j]) == OWALL ) ||
  932. X                  (objnamelist[k] == floorc))
  933. X                            nlprc( objnamelist[k] );
  934. X                        else
  935. X                            {
  936. X                            setbold();
  937. X                            nlprc( objnamelist[k] );
  938. X                            resetbold();
  939. X                            }
  940. X                        }
  941. X                    else
  942. X                        /* error condition.  recover by resetting location
  943. X                           to an 'unknown' state.
  944. X                        */
  945. X                        {
  946. X                        nlprc( ' ' );
  947. X                        mitem[i][j] = item[i][j] = 0 ;
  948. X                        }
  949. X            else /* non-bold objects here */
  950. X                for ( i=ileft ; i <= iright ; i++ )
  951. X
  952. X                    /* we still need to check for the location being known,
  953. X                       for we might have an unknown spot in the middle of
  954. X                       an otherwise known line.
  955. X                    */
  956. X                    if ( know[i][j] == 0 )
  957. X                        nlprc( ' ' );
  958. X                    else if ( know[i][j] & HAVESEEN )
  959. X                        {
  960. X                        /* if monster there and the user still knows the place,
  961. X                           then show the monster.  Otherwise, show what was
  962. X                           there before.
  963. X                        */
  964. X                        if (( k = mitem[i][j] ) &&
  965. X                            ( know[i][j] & KNOWHERE ))
  966. X                            nlprc( monstnamelist[k] );
  967. X                        else
  968. X                            nlprc( objnamelist[item[i][j]] );
  969. X                        }
  970. X                    else
  971. X                        /* error condition.  recover by resetting location
  972. X                           to an 'unknown' state.
  973. X                        */
  974. X                        {
  975. X                        nlprc( ' ' );
  976. X                        mitem[i][j] = item[i][j] = 0 ;
  977. X                        }
  978. X            }   /* if (ileft < d_xmax ) */
  979. X        }       /* for (j) */
  980. X
  981. X#ifdef DECRainbow
  982. X    if (DECRainbow)
  983. X        DECgraphicsOFF();
  984. X#endif DECRainbow
  985. X    resetbold();
  986. X    if (d_flag)  { always=1; botside(); always=1; bot_linex(); }
  987. X    oldx=99;
  988. X    d_xmin = d_ymin = 0; d_xmax = MAXX; d_ymax = MAXY; /* for limited screen drawing */
  989. X    }
  990. X
  991. X/*
  992. X    showcell(x,y)
  993. X
  994. X    subroutine to display a cell location on the screen
  995. X */
  996. Xshowcell(x,y)
  997. X    int x,y;
  998. X    {
  999. X    register int i,j,k,m;
  1000. X    if (c[BLINDCOUNT])  return; /* see nothing if blind     */
  1001. X    if (c[AWARENESS]) { minx = x-3; maxx = x+3; miny = y-3; maxy = y+3; }
  1002. X            else      { minx = x-1; maxx = x+1; miny = y-1; maxy = y+1; }
  1003. X
  1004. X    if (minx < 0) minx=0;       if (maxx > MAXX-1) maxx = MAXX-1;
  1005. X    if (miny < 0) miny=0;       if (maxy > MAXY-1) maxy = MAXY-1;
  1006. X
  1007. X    for (j=miny; j<=maxy; j++)
  1008. X      for (m=minx; m<=maxx; m++)
  1009. X        if ((know[m][j] & KNOWHERE) == 0)
  1010. X            {
  1011. X            cursor(m+1,j+1);
  1012. X        x=maxx;
  1013. X        while (know[x][j] & KNOWHERE)
  1014. X        --x;
  1015. X            for (i=m; i<=x; i++)
  1016. X                {
  1017. X                if ((k=mitem[i][j]) != 0)  lprc(monstnamelist[k]);
  1018. X                else switch(k=item[i][j])
  1019. X                    {
  1020. X                    case OWALL:  case 0: case OIVTELETRAP:  case OTRAPARROWIV:
  1021. X                    case OIVDARTRAP: case OIVTRAPDOOR:
  1022. X#ifdef DECRainbow
  1023. X                        if (DECRainbow) {
  1024. X                            DEClprc(objnamelist[k]);
  1025. X                        } else
  1026. X#endif DECRainbow
  1027. X                        lprc(objnamelist[k]);   
  1028. X                        break;
  1029. X                    default:
  1030. X                        if (boldobjects)
  1031. X                            setbold();
  1032. X                        lprc(objnamelist[k]);
  1033. X                        if (boldobjects)
  1034. X                            resetbold();
  1035. X                        break;
  1036. X                    };
  1037. X                know[i][j] = KNOWALL;
  1038. X                }
  1039. X            m = maxx;
  1040. X#ifdef DECRainbow
  1041. X            if (DECRainbow)
  1042. X                DECgraphicsOFF();
  1043. X#endif DECRainbow
  1044. X            }
  1045. X    }
  1046. X
  1047. X/*
  1048. X    this routine shows only the spot that is given it.  the spaces around
  1049. X    these coordinated are not shown
  1050. X    used in godirect() in monster.c for missile weapons display
  1051. X */
  1052. Xshow1cell(x,y)
  1053. X    int x,y;
  1054. X    {
  1055. X    if (c[BLINDCOUNT])  return; /* see nothing if blind     */
  1056. X    cursor(x+1,y+1);
  1057. X    if ((k=mitem[x][y]))
  1058. X        lprc(monstnamelist[k]);
  1059. X    else switch(k=item[x][y])
  1060. X        {
  1061. X        case OWALL:  case 0:  case OIVTELETRAP:  case OTRAPARROWIV:
  1062. X        case OIVDARTRAP: case OIVTRAPDOOR:
  1063. X# ifdef DECRainbow
  1064. X            if (DECRainbow) {
  1065. X                DEClprc(objnamelist[k]);
  1066. X                DECgraphicsOFF();
  1067. X            } else
  1068. X# endif
  1069. X                lprc(objnamelist[k]);
  1070. X                break;
  1071. X
  1072. X        default:
  1073. X            if (boldobjects)
  1074. X                setbold();
  1075. X            lprc(objnamelist[k]);
  1076. X            if (boldobjects)
  1077. X                resetbold();
  1078. X            break;
  1079. X        };
  1080. X    know[x][y] = KNOWALL;   /* we end up knowing about it */
  1081. X    }
  1082. X
  1083. X/*
  1084. X    showplayer()
  1085. X
  1086. X    subroutine to show where the player is on the screen
  1087. X    cursor values start from 1 up
  1088. X */
  1089. Xshowplayer()
  1090. X    {
  1091. X    cursor(playerx+1,playery+1);
  1092. X    oldx=playerx;  oldy=playery;
  1093. X    }
  1094. X
  1095. X/*
  1096. X    moveplayer(dir)
  1097. X
  1098. X    subroutine to move the player from one room to another
  1099. X    returns 0 if can't move in that direction or hit a monster or on an object
  1100. X    else returns 1
  1101. X    nomove is set to 1 to stop the next move (inadvertent monsters hitting
  1102. X    players when walking into walls) if player walks off screen or into wall
  1103. X */
  1104. Xshort diroffx[] = { 0,  0, 1,  0, -1,  1, -1, 1, -1 };
  1105. Xshort diroffy[] = { 0,  1, 0, -1,  0, -1, -1, 1,  1 };
  1106. Xmoveplayer(dir)
  1107. X    int dir;            /*  from = present room #  direction = [1-north]
  1108. X                            [2-east] [3-south] [4-west] [5-northeast]
  1109. X                            [6-northwest] [7-southeast] [8-southwest]
  1110. X                        if direction=0, don't move--just show where he is */
  1111. X    {
  1112. X    register int k,m,i,j;
  1113. X    extern char prayed ;
  1114. X
  1115. X    if (c[CONFUSE]) if (c[LEVEL]<rnd(30)) dir=rund(9); /*if confused any dir*/
  1116. X    k = playerx + diroffx[dir];     m = playery + diroffy[dir];
  1117. X    if (k<0 || k>=MAXX || m<0 || m>=MAXY) { nomove=1; return(yrepcount = 0); }
  1118. X    i = item[k][m];         j = mitem[k][m];
  1119. X
  1120. X    /* prevent the player from moving onto a wall, or a closed door when
  1121. X       in command mode, unless the character has Walk-Through-Walls.
  1122. X    */
  1123. X    if ((i==OCLOSEDDOOR && !prompt_mode) || (i==OWALL) && c[WTW]==0)
  1124. X        { 
  1125. X        nomove=1;  
  1126. X        return(yrepcount = 0); 
  1127. X        }
  1128. X    if (k==33 && m==MAXY-1 && level==1)
  1129. X        {
  1130. X        newcavelevel(0); for (k=0; k<MAXX; k++) for (m=0; m<MAXY; m++)
  1131. X        if (item[k][m]==OENTRANCE)
  1132. X          { playerx=k; playery=m; positionplayer();  drawscreen(); return(0); }
  1133. X        }
  1134. X    /* hit a monster
  1135. X    */    
  1136. X    if (j>0)     
  1137. X        { hitmonster(k,m); return(yrepcount = 0); } 
  1138. X
  1139. X    /* check for the player ignoring an altar when in command mode.
  1140. X    */
  1141. X    if ((!prompt_mode) &&
  1142. X        (item[playerx][playery] == OALTAR) &&
  1143. X        (!prayed))
  1144. X        {
  1145. X    cursors();
  1146. X    lprcat("\nYou have ignored the altar!");
  1147. X    act_ignore_altar();
  1148. X    }
  1149. X    prayed = 0 ;
  1150. X
  1151. X    lastpx = playerx;   lastpy = playery;
  1152. X    playerx = k;        playery = m;
  1153. X    if (i && i!=OTRAPARROWIV && i!=OIVTELETRAP && i!=OIVDARTRAP && i!=OIVTRAPDOOR) 
  1154. X        return(yrepcount = 0);  
  1155. X    else 
  1156. X        return(1);
  1157. X    }
  1158. X
  1159. X/*
  1160. X *  function to show what magic items have been discovered thus far
  1161. X *  enter with -1 for just spells, anything else will give scrolls & potions
  1162. X */
  1163. Xstatic int lincount,count;
  1164. Xseemagic(arg)
  1165. X    int arg;
  1166. X    {
  1167. X    register int i,number;
  1168. X    count = lincount = 0;  nosignal=1;
  1169. X
  1170. X    if (arg== -1) /* if display spells while casting one */
  1171. X        {
  1172. X        for (number=i=0; i<SPNUM; i++) if (spelknow[i]) number++;
  1173. X        number = (number+2)/3 + 4;  /* # lines needed to display */
  1174. X        cl_up(79,number);  cursor(1,1);
  1175. X        }
  1176. X    else
  1177. X        {
  1178. X        resetscroll();  clear();
  1179. X        }
  1180. X
  1181. X    lprcat("The magic spells you have discovered thus far:\n\n");
  1182. X    for (i=0; i<SPNUM; i++)
  1183. X        if (spelknow[i])
  1184. X            { lprintf("%s %-20s ",spelcode[i],spelname[i]);  seepage(); }
  1185. X
  1186. X    if (arg== -1)
  1187. X        {
  1188. X        seepage();  more();  nosignal=0;
  1189. X        draws(0,MAXX,0,number);  return;
  1190. X        }
  1191. X
  1192. X    lincount += 3;  if (count!=0) { count=2;  seepage(); }
  1193. X
  1194. X    lprcat("\nThe magic scrolls you have found to date are:\n\n");
  1195. X    count=0;
  1196. X    for (i=0; i<MAXSCROLL; i++)
  1197. X        if (scrollname[i][0])
  1198. X          if (scrollname[i][1]!=' ')
  1199. X            { lprintf("%-26s",&scrollname[i][1]);  seepage(); }
  1200. X
  1201. X    lincount += 3;  if (count!=0) { count=2;  seepage(); }
  1202. X
  1203. X    lprcat("\nThe magic potions you have found to date are:\n\n");
  1204. X    count=0;
  1205. X    for (i=0; i<MAXPOTION; i++)
  1206. X        if (potionname[i][0])
  1207. X          if (potionname[i][1]!=' ')
  1208. X            { lprintf("%-26s",&potionname[i][1]);  seepage(); }
  1209. X
  1210. X    if (lincount!=0) more();    nosignal=0;  setscroll();   drawscreen();
  1211. X    }
  1212. X
  1213. X/*
  1214. X *  subroutine to paginate the seemagic function
  1215. X */
  1216. Xstatic seepage()
  1217. X    {
  1218. X    if (++count==3)
  1219. X        {
  1220. X        lincount++; count=0;    lprc('\n');
  1221. X        if (lincount>17) {  lincount=0;  more();  clear();  }
  1222. X        }
  1223. X    }
  1224. END_OF_FILE
  1225. if test 18900 -ne `wc -c <'display.c'`; then
  1226.     echo shar: \"'display.c'\" unpacked with wrong size!
  1227. fi
  1228. # end of 'display.c'
  1229. fi
  1230. if test -f 'larn.opt' -a "${1}" != "-c" ; then 
  1231.   echo shar: Will not clobber existing file \"'larn.opt'\"
  1232. else
  1233. echo shar: Extracting \"'larn.opt'\" \(83 characters\)
  1234. sed "s/^X//" >'larn.opt' <<'END_OF_FILE'
  1235. Xname: "Mr. Wizard"
  1236. Xauto-pickup
  1237. Xhighlight-objects
  1238. Xbold-objects
  1239. Xmale
  1240. Xno-introduction
  1241. END_OF_FILE
  1242. if test 83 -ne `wc -c <'larn.opt'`; then
  1243.     echo shar: \"'larn.opt'\" unpacked with wrong size!
  1244. fi
  1245. # end of 'larn.opt'
  1246. fi
  1247. if test -f 'larn.prj' -a "${1}" != "-c" ; then 
  1248.   echo shar: Will not clobber existing file \"'larn.prj'\"
  1249. else
  1250. echo shar: Extracting \"'larn.prj'\" \(597 characters\)
  1251. sed "s/^X//" >'larn.prj' <<'END_OF_FILE'
  1252. XACTION.C  (HEADER.H)
  1253. XBILL.C    (HEADER.H)
  1254. XCONFIG.C  (HEADER.H)
  1255. XCREATE.C  (HEADER.H)
  1256. XDATA.C    (HEADER.H)
  1257. XDIAG.C    (HEADER.H)
  1258. XDISPLAY.C (HEADER.H)
  1259. XFORTUNE.C (HEADER.H)
  1260. XGLOBAL.C  (HEADER.H)
  1261. XHELP.C    (HEADER.H)
  1262. XIO.C      (HEADER.H)
  1263. XMAIN.C    (HEADER.H)
  1264. XMONSTER.C (HEADER.H)
  1265. XMOREOBJ.C (HEADER.H)
  1266. XMOVEM.C   (HEADER.H)
  1267. XMSDOS.C   (HEADER.H)
  1268. XNAP.C
  1269. XOBJECT.C  (HEADER.H)
  1270. XREGEN.C   (HEADER.H)
  1271. XSAVELEV.C (HEADER.H)
  1272. XSCORES.C  (HEADER.H)
  1273. XSIGNAL.C  (HEADER.H)
  1274. XSPELLS.C  (HEADER.H)
  1275. XSPHERES.C (HEADER.H)
  1276. XSTORE.C   (HEADER.H)
  1277. XTOK.C     (HEADER.H)
  1278. XVMS.C     (HEADER.H)
  1279. Xfgetlr.c
  1280. Xtgetent.c
  1281. Xtgetstr.c
  1282. Xtputs.c
  1283. Xtgoto.c
  1284. END_OF_FILE
  1285. if test 597 -ne `wc -c <'larn.prj'`; then
  1286.     echo shar: \"'larn.prj'\" unpacked with wrong size!
  1287. fi
  1288. # end of 'larn.prj'
  1289. fi
  1290. echo shar: End of archive 2 \(of 11\).
  1291. cp /dev/null ark2isdone
  1292. MISSING=""
  1293. for I in 1 2 3 4 5 6 7 8 9 10 11 ; do
  1294.     if test ! -f ark${I}isdone ; then
  1295.     MISSING="${MISSING} ${I}"
  1296.     fi
  1297. done
  1298. if test "${MISSING}" = "" ; then
  1299.     echo You have unpacked all 11 archives.
  1300.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1301. else
  1302.     echo You still need to unpack the following archives:
  1303.     echo "        " ${MISSING}
  1304. fi
  1305. ##  End of shell archive.
  1306. exit 0
  1307.